# Uncomment the next line to define a global platform for your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'

install! 'cocoapods', :disable_input_output_paths => true



target 'SnowVision' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  use_modular_headers!
  
  # Pods for IMTest
  

  #地图
  pod 'AMap3DMap-NO-IDFA'
  pod 'AMapLocation-NO-IDFA'
  pod 'AMapSearch-NO-IDFA'
  
  
  
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      #Fix Xcode14 Bundle target error
      config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
      config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
      config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
      config.build_settings['ENABLE_BITCODE'] = "NO"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "13.0"
      #Fix Xcode15 other links  flag  -ld64
      xcode_version = `xcrun xcodebuild -version | grep Xcode | cut -d' ' -f2`.to_f
      if xcode_version >= 15
        xcconfig_path = config.base_configuration_reference.real_path
        xcconfig = File.read(xcconfig_path)
        if xcconfig.include?("OTHER_LDFLAGS") == false
          xcconfig = xcconfig + "\n" + 'OTHER_LDFLAGS = $(inherited) "-ld64"'
        else
          if xcconfig.include?("OTHER_LDFLAGS = $(inherited)") == false
            xcconfig = xcconfig.sub("OTHER_LDFLAGS", "OTHER_LDFLAGS = $(inherited)")
          end
          if xcconfig.include?("-ld64") == false
            xcconfig = xcconfig.sub("OTHER_LDFLAGS = $(inherited)", 'OTHER_LDFLAGS = $(inherited) "-ld64"')
          end
        end
        File.open(xcconfig_path, "w") { |file| file << xcconfig }
      end
    end
  end
end
